uniform sampler2D Outlines;
uniform sampler2D textureMap;

uniform vec2 offset[9];
uniform int kernel[9];

void main() {

        int i;
        vec4 color = vec4(0.0);
         
        //color = texture2D(textureMap, gl_TexCoord[0].st);

        vec4 outline = texture2D(Outlines, gl_TexCoord[0].st);
       
        
        //let's try to average the color out
        for (i=0 ; i<9; i++){
            vec4 color4f = texture2D(textureMap, gl_TexCoord[0].st + offset[i]);
            color += 0.1*color4f*kernel[i];
        } 
        

        outline = vec4(1.0) - outline;
        gl_FragColor = outline*color; 
}
